package java03.bll;

public class Student {
    //静态的属性-人的共同属性
    private String id;
    public String name;
    int age;//学生年龄必须在5-35之间
    protected String gender;
    //静态的属性-学生的特有属性
    private String sno;

    //动态的行为-人的共同行为
    public void eating() {
        System.out.println(name + "在恰饭！");
        sno = "1001";
        age = 23;
        gender="男";
    }

    //动态的行为-学生的特有行为
    public void studying() {
        System.out.println(this.name + "在学习！");
    }

    public void setAge(int age) throws Exception {
        if (age < 5 || age > 35) {
            throw new Exception("你想干那样？年龄数据不对！");
        }
        this.age = age;
    }
    // 默认的系统自带的构造函数
    public Student() {

    }


    /*public Student(String sno, String name, int age) {
        this.sno=sno;
        this.name=name;
        this.age = age;
    }*/
}





